local weiyi = fk.CreateSkill{
    name = "tyj_heg__weiyi",
}
local H = require "packages.ol_hegemony.util"
local U = require "packages.utility.utility"
 Fk:loadTranslationTable{
      ["tyj_heg__weiyi"]="威仪",
      [":tyj_heg__weiyi"]="与你势力相同的角色于摸牌阶段内摸牌时，若其装备区内的牌数小于你，你可以改为由你摸牌，然后交给其等量张牌。",
      ["#tyj_heg__weiyi-invoke"]="是否发动 威仪 令你摸 %dest 即将摸的 %arg 张牌？",
      ["#tyj_heg__weiyi-give"]="威仪：你需要交给 %dest %arg 张牌",
      ["$tyj_heg__weiyi1"] = "无威仪者，不可奉社稷。",
  ["$tyj_heg__weiyi2"] = "有威仪者，进止雍容。",
    }
    weiyi:addEffect(fk.BeforeDrawCard,{
        name = "tyj_heg__weiyi",
      anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return H.compareKingdomWith(player,target) and #target:getCardIds('e') < #player:getCardIds('e') and player:hasSkill(weiyi.name) and data.skillName~=weiyi.name and data.num > 0 and target.phase == Player.Draw
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    return room:askToSkillInvoke(player,{
        skill_name = weiyi.name,
        prompt = "#tyj_heg__weiyi-invoke::"..target.id..":"..data.num
    })
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    room:drawCards(player,data.num,weiyi.name)
    if #player:getCardIds('he')>0 then
        local cardsm = room:askToCards(player, {
    min_num = math.min(#player:getCardIds('he'),data.num),
    max_num = math.min(#player:getCardIds('he'),data.num),
    include_equip = true,
    skill_name = weiyi.name,
    prompt = "#tyj_heg__weiyi-give::"..target.id..":"..data.num,
    cancelable = false,
  })
      if #cardsm>0 then
        room:moveCardTo(cardsm, Player.Hand,target, fk.ReasonGive, weiyi.name, nil, false, player)
      end
    end
    data.num = 0
  end,
    })
    return weiyi